using QFramework;
using QFramework.Game;
using QGameFramework.Enums;
using UnityEditor;
using UnityEngine;

namespace QGameFramework.QProcedure
{
    public class VerifyState : AbstractState<States, ProcedureComponent>
    {
        public VerifyState(FSM<States> fsm, ProcedureComponent target) : base(fsm, target)
        {
        }

        protected override void OnEnter()
        {
            base.OnEnter();
            if (!QGFC.Instance.License.m_IsExpired)
            {
                mFSM.ChangeState(States.Gaming);
            }
            else
            {
#if UNITY_EDITOR
                if (QGFC.Instance.License.m_IsExpired && QGFC.Instance.License.m_LicenseSO.m_License.m_EnableInEditor)
                    EditorApplication.isPlaying = false;
# else
                Application.Quit();
#endif
            }
        }

        protected override void OnUpdate()
        {
            base.OnUpdate();
        }

        protected override void OnExit()
        {
            base.OnExit();
        }
    }
}